package com.ruoyi.maintenance.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.maintenance.mapper.MaintenancePlanMapper;
import com.ruoyi.maintenance.domain.MaintenancePlan;
import com.ruoyi.maintenance.service.IMaintenancePlanService;

/**
 * 维护计划Service业务层处理
 * 
 * @author silence
 * @date 2025-07-21
 */
@Service
public class MaintenancePlanServiceImpl implements IMaintenancePlanService 
{
    @Autowired
    private MaintenancePlanMapper maintenancePlanMapper;

    /**
     * 查询维护计划
     * 
     * @param id 维护计划主键
     * @return 维护计划
     */
    @Override
    public MaintenancePlan selectMaintenancePlanById(Long id)
    {
        return maintenancePlanMapper.selectMaintenancePlanById(id);
    }

    /**
     * 查询维护计划列表
     * 
     * @param maintenancePlan 维护计划
     * @return 维护计划
     */
    @Override
    public List<MaintenancePlan> selectMaintenancePlanList(MaintenancePlan maintenancePlan)
    {
        return maintenancePlanMapper.selectMaintenancePlanList(maintenancePlan);
    }

    /**
     * 新增维护计划
     * 
     * @param maintenancePlan 维护计划
     * @return 结果
     */
    @Override
    public int insertMaintenancePlan(MaintenancePlan maintenancePlan)
    {
        maintenancePlan.setCreateTime(DateUtils.getNowDate());
        return maintenancePlanMapper.insertMaintenancePlan(maintenancePlan);
    }

    /**
     * 修改维护计划
     * 
     * @param maintenancePlan 维护计划
     * @return 结果
     */
    @Override
    public int updateMaintenancePlan(MaintenancePlan maintenancePlan)
    {
        maintenancePlan.setUpdateTime(DateUtils.getNowDate());
        return maintenancePlanMapper.updateMaintenancePlan(maintenancePlan);
    }

    /**
     * 批量删除维护计划
     * 
     * @param ids 需要删除的维护计划主键
     * @return 结果
     */
    @Override
    public int deleteMaintenancePlanByIds(Long[] ids)
    {
        return maintenancePlanMapper.deleteMaintenancePlanByIds(ids);
    }

    /**
     * 删除维护计划信息
     * 
     * @param id 维护计划主键
     * @return 结果
     */
    @Override
    public int deleteMaintenancePlanById(Long id)
    {
        return maintenancePlanMapper.deleteMaintenancePlanById(id);
    }
}
